package com.systop.controller;

import com.systop.pojo.Admin;
import com.systop.service.AdminService;
import com.systop.unti.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * @Author zhangnan
 * @Data 2020/7/030 上午 10:49
 * @Descriiption
 **/
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    //登陆
    @RequestMapping(value="/a_login",method = RequestMethod.POST)
    public ResponseResult login(@RequestParam("admin_name") String admin_name, @RequestParam("admin_password") String admin_password,HttpSession session){
        System.out.println(admin_name);
        System.out.println(admin_password);
        session.setAttribute("admin_name",admin_name);
        session.setAttribute("admin_password",admin_password);
        return adminService.login(admin_name,admin_password);
    }
    //注册
    @RequestMapping(value="/a_loginin",method = RequestMethod.POST)
    public ResponseResult loginin(@RequestParam("admin_name") String admin_name,@RequestParam("admin_password") String admin_password){
        System.out.println("++++++++++++注册+++++++++");
        System.out.println(admin_name);
        System.out.println(admin_password);
        return adminService.loginin(admin_name,admin_password);
    }

}
